home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1995 November / Macworld Nov ’95.toast / Developers / Selection ƒ 2.5 / DBH Mops Extensions < prev    next >
Encoding:
Text File  |  1994-11-06  |  647 b   |  40 lines  |  [TEXT/MSET]

  1. \ A few general words needed by the selection environment.
  2.  
  3. \ ***** QuickDraw *********
  4.  
  5.  
  6. : InitCursor arrowcurs ;    \ familiar names die hard
  7.  
  8. : PtInRect { x y rptr -- b }
  9.     word0 x y pack rptr call PtInRect i->l ;
  10.  
  11. : mDrawString  ( addr len -- )
  12.     str255 call DrawString ;
  13.  
  14. : mStringWidth    \ ( addr len -- width )
  15.         \ Returns width of string in current font
  16.     str255 >r  word0  r>  call StringWidth  word0  ;
  17.  
  18.  
  19. \ **** Numeric Conversion ****
  20.  
  21. : number>$  ( n -- addr len )
  22.     dup 0<
  23.     IF
  24.         abs 0 <# #s  & - hold
  25.     ELSE
  26.         0 <# #s
  27.     THEN
  28.         #> ;
  29.  
  30. endload
  31.  
  32. *** EXAMPLE USE
  33.  
  34. 20 40 temprect PtInRect .
  35.  
  36. " Hello World" mDrawString
  37.  
  38. " Hello World" mStringWidth .
  39.  
  40.